<template>
  <div>
    <detail-banner
      :sightName="sightName"
      :bannerImg="bannerImg"
      :gallaryImgs="gallaryImgs"
    ></detail-banner>
    <detail-header></detail-header>
    <div class="content">
      <detail-list :list="list"></detail-list>
    </div>
  </div>
</template>

<script>
import detailBanner from './components/Banner'
import detailHeader from './components/Header'
import detailList from './components/List'
import axios from 'axios'

export default {
  name: 'detail',
  data () {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      gallaryImgs: []
    }
  },
  components: {
    detailBanner,
    detailHeader,
    detailList
  },
  methods: {
    getDetailInfo () {
      axios.get('http://localhost:8080/mock/detail.json', {
        params: {
          id: this.$route.params.id
        }
      })
        .then(res => {
          res = res.data
          const data = res.data
          this.sightName = data.sightName
          this.list = data.categoryList
          this.bannerImg = data.bannerImg
          this.gallaryImgs = data.gallaryImgs
        })
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>
.content
  height 50rem
</style>
